package com.kedi.homeservicecenter.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.kedi.homeservicecenter.service.HomeServiceCenterService;

import java.util.List;
import java.util.Map;

/**
 * 
* @Description: 家政服务商家控制层
* @author: clx 
* @date: 2019 2019年7月8日 下午2:00:59
 */
@RestController
public class HomeServiceCenterController {
    @Autowired
    private HomeServiceCenterService homeServiceCenterFeignService;
   

    @RequestMapping(value = "/selectcommodity",method = RequestMethod.POST)
    public List<Map<String, Object>> selectBusinessCommodity(int total_page,int limit) {
    	if (total_page != 0&&limit != 0) {
    		int page = (total_page - 1) * limit;
    		return homeServiceCenterFeignService.selectCommodity(page,limit);
		}else {
			return null;
		}
    }
    /**
     * @Description:根据id返回详情
     * @return
     */
    @RequestMapping(value = "/businesscommodityone",method = RequestMethod.GET)
    public Map getBusinessCommodityById(int id) {
    	
    	return homeServiceCenterFeignService.getCommodityDetailbyid(id);

    }
    
    @RequestMapping(value = "/getCommodityDetailbyid",method = RequestMethod.POST)
    public Map<String, Object> getCommodityDetailbyid1(int id) {
    	if (id != 0) {
    		return homeServiceCenterFeignService.getCommodityDetailbyid(id);
		}else {
			return null;
		}
    }
}
